import java.util.Scanner;

public class testDemo {
    //用scanner读取字符串、整数、浮点数
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        System.out.println("请输入你的姓名");
        String name = sc.nextLine();
        System.out.println("请输入你的年龄");
        int age = sc.nextInt();
        System.out.println("请输入你的工资");
        float pay = sc.nextFloat();
        System.out.println("你的信息如下");
        System.out.println("你的姓名是："+name+"\n你的年龄是："+age+"\n你的工资是"+pay);
    }
    //计算1!+2!+3!+4!+5!
    public static void main16(String[] args) {
        int num = 0;
        for (int i = 1; i <= 5; i++) {
            int ret = 1;
            for (int j = 1; j <=i ; j++) {
                ret *= j;
            }
            num += ret;
        }
        System.out.println(num);
    }
    //计算5的阶乘
    public static void main15(String[] args) {
        int ret = 1;
        for (int i = 1; i <=5 ; i++) {
            ret *= i;
        }
        System.out.println(ret);
    }
    //计算1~100的和
    public static void main14(String[] args) {
        int num = 0;
        for (int i = 1; i <=100 ; i++) {
            num += i;
        }
        System.out.println(num);
    }
    //打印1~10的数字
    public static void main13(String[] args) {
        for (int i = 1; i <=10 ; i++) {
            System.out.println(i);
        }
    }
    //找到100~200当中所有3的倍数
    public static void main12(String[] args) {
        int i =100;
        while(i<=200){
            if(i%3!=0){
                i++;
                continue;
            }
            System.out.println("找到了3的倍数："+i);
            i++;
        }
    }
    //找到100~200中第一个3的倍数
    public static void main11(String[] args) {
        int i = 100;
        while(i<=200){
            if(i%3==0){
                System.out.println(i);
                break;
            }
            i++;
        }
    }
    //计算1!+2!+3!+4!+5!
    public static void main10(String[] args) {
        int i = 1;
        int sum = 0;
        while(i<=5){
            int j = 1;
            int ret =1;
            while(j<=i){
                ret*=i;
                j++;
            }
            i++;
            sum+=ret;
        }
        System.out.println(sum);
    }
    //计算5的阶乘
    public static void main9(String[] args) {
        int i = 1;
        int ret =1;
        while(i<=5){
            ret *= i;
            i++;
        }
        System.out.println(ret);
    }
    //计算1~100的和
    public static void main8(String[] args) {
        int i = 1;
        int num = 0;
        while(i<=100){
            num += i;
            i++;
        }
        System.out.println(num);
    }
    //打印1~10的数字
    public static void main7(String[] args) {
        int i =1;
        while(i<=10){
            System.out.println(i);
            i++;
        }
    }
    //根据day的值输出日期
    public static void main6(String[] args) {
        int day = 1;
        switch (day){
            case 1:
                System.out.println("星期一");
                break;
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期四");
                break;
            case 4:
                System.out.println("星期五");
                break;
            case 5:
                System.out.println("星期六");
                break;
            case 6:
                System.out.println("星期天");
                break;
            default:
                System.out.println("输入有误");
            break;
        }
    }
    //判断是否是闰年优化版
    public static void main5(String[] args) {
        int year =2000;
        if((year%100==0 && year%400==0) || year%4==0){
            System.out.println("是闰年");
        }else{
            System.out.println("不是闰年");
        }
    }
    //判断是否是闰年
    public static void main4(String[] args) {
        int year = 2000;
        //判断是否是世纪闰年
        if(year%100==0 ){
            if(year%400==0){
                System.out.println("是世纪闰年");
            }else{
                System.out.println("不是世纪闰年");
            }
            //判断是否是普通闰年
        }else{
            if(year%4==0){
                System.out.println("是普通闰年");
            }else{
                System.out.println("不是普通闰年");
            }
        }
    }
    public static void main3(String[] args) {
        int i = 10;
        if(i<0){
            System.out.println("负数");
        }else if(i>0){
            System.out.println("正数");
        }else{
            System.out.println("0");
        }
    }
    //判断一个数是否是正数
    public static void main2(String[] args) {
        int i = 10;
        if(i%2==0){
            System.out.println("偶数");
        }else {
            System.out.println("奇数");
        }
    }
    //交换两个int类型的值
    public static void main1(String[] args) {
        int a = 5;
        int b = 10;
        int c = 2;
        c = a;
        a = b;
        b = c;
        System.out.println("a="+a+"b="+b);
    }
}
